#include "Progress.h"

#define TARGET_SIZE 1024*1024
#define DOWN_SIZE 1024*10

//void download(){
//    int curdown = 0;
//    int target = TARGET_SIZE;
//    while(curdown < target){
//        usleep(PAUSE_TIME);
//        curdown+=DOWN_SIZE;
//        int rate = curdown* 100/target;
//        process_v2(rate);
//    }
//    printf("\n");
//}

void download(callback_t cd){
    int curdown = 0;
    int target = TARGET_SIZE;
    while(curdown < target){
        usleep(PAUSE_TIME);
        curdown+=DOWN_SIZE;
        double rate = curdown* 100.0/target;
        cd(rate);
    }
    cd(100);
    printf("\n");
}
int main() {
    download(process_v3);
    return 0;
}
